﻿using LineOfBusiness.Controls.Base;
using LineOfBusiness.DataAccess;
using LineOfBusiness.Poco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace LineOfBusiness.AD.Controllers
{
    public class MessagesController : LOBController
    {
        public MessagesController()
        {
            this.GridViewName = "grvMessages";
        }

        public ActionResult Index()
        {

            return View();
        }

        [HttpPost]
        public ActionResult Save(SYS_Messages message)
        {
            if (message.CreatedBy == null) message.CreatedBy = "";
            using (EFDALContainer dal = new EFDALContainer())
            {
                try
                {
                    dal.Repository.Update(message);
                    dal.UnitOfWork.SaveChanges();
                }
                catch (Exception exp)
                {
                    return Json(exp.Message);
                }
                return Json("0");
            }
        }

    }
}
